#ifndef __EC5_H__
#define __EC5_H__

#include <string>


#define PORT_NUM_LEN 20

#define MAX_THREADS 1
#define BUF_SIZE 255


typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;




typedef struct tagEC5_wfv
{
    uint8 amType;
    uint8 group;

    uint16 nodeId;
    uint8 socketId;

    uint8 boardId;
    uint8 packetId;
    uint16 parentId;

    uint16 E1ReferenceADC;
    uint16 E1ExcitationV;
    uint16 soilWaterContent;
    uint16 E1ExcitationADC;
    uint16 soilWaterContentADC;
}EC5_WFV_S;

typedef struct ec5MetaType
{
    std::string name;
    int byteoffset;
    int length;
    std::string type;    
}EC5_META_S;

typedef struct ec5MetaTypeCONVERSION
{
    std::string name;
    std::string function;
    std::vector<std::string> XConvParams;
}EC5_META_CONVERSION_S;

typedef struct ec5CondType
{
    std::string fieldname; 
    unsigned int fieldvalue;   
}EC5_XCOND_S;

// Sample custom data structure for threads to use.
// This is passed by void pointer so it can be any data type
// that can be passed using a single void pointer (LPVOID).
typedef struct MyData {
    HWND hWnd;
    short portNum;
} MYDATA, *PMYDATA;

extern HANDLE m_hKillEvent;

std::string& repalce_all_ditinct(std::string& str,const std::string&old_value,const std::string& new_value);

double postfixCalculate2(std::string& postfix);

int startTcpServer(int portNum);

DWORD WINAPI MyThreadFunction( LPVOID lpParam );
void ErrorHandler(LPTSTR lpszFunction);



#endif /* __EC5_H__ */

/* end of file */
